import java.util.ArrayList;
import java.util.Scanner;

public class Main1084 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long num = sc.nextLong();
        ArrayList<Long> arr = new ArrayList<>();
        for (long i = 1; i <= Math.sqrt(num); i++) {
            if (num % i == 0) {
                arr.add(i);
                long n = num / i;
                if (n != i) {
                    arr.add(n);
                }
            }
        }
        long count = 0;
        for (int i = 0; i < arr.size(); i++) {
            if (arr.get(i) == 1) continue;
            if (arr.get(i) == num) continue;
            count += arr.get(i);
        }
        System.out.println(count);
    }

}
